<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
<!-- photoviewer.qdoc -->
  <title>Qt Quick Demo - Photo Viewer | Qt 5.14</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="index.html">Qt 5.14</a></td><td >Qt Quick Demo - Photo Viewer</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.14.2 Reference Documentation</td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<h1 class="title">Qt Quick Demo - Photo Viewer</h1>
<span class="subtitle"></span>
<pre class="qml">

  <span class="comment">/****************************************************************************
  **
  ** Copyright (C) 2016 The Qt Company Ltd.
  ** Contact: https://www.qt.io/licensing/
  **
  ** This file is part of the examples of the Qt Toolkit.
  **
  ** $QT_BEGIN_LICENSE:BSD$
  ** Commercial License Usage
  ** Licensees holding valid commercial Qt licenses may use this file in
  ** accordance with the commercial license agreement provided with the
  ** Software or, alternatively, in accordance with the terms contained in
  ** a written agreement between you and The Qt Company. For licensing terms
  ** and conditions see https://www.qt.io/terms-conditions. For further
  ** information use the contact form at https://www.qt.io/contact-us.
  **
  ** BSD License Usage
  ** Alternatively, you may use this file under the terms of the BSD license
  ** as follows:
  **
  ** &quot;Redistribution and use in source and binary forms, with or without
  ** modification, are permitted provided that the following conditions are
  ** met:
  **   * Redistributions of source code must retain the above copyright
  **     notice, this list of conditions and the following disclaimer.
  **   * Redistributions in binary form must reproduce the above copyright
  **     notice, this list of conditions and the following disclaimer in
  **     the documentation and/or other materials provided with the
  **     distribution.
  **   * Neither the name of The Qt Company Ltd nor the names of its
  **     contributors may be used to endorse or promote products derived
  **     from this software without specific prior written permission.
  **
  **
  ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  ** &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&quot;
  **
  ** $QT_END_LICENSE$
  **
  ****************************************************************************/</span>

  import QtQuick 2.0
  import QtQuick.XmlListModel 2.0
  import QtQml.Models 2.1

  <span class="type"><a href="../qtqml/qml-qtqml-component.html">Component</a></span> {
      <span class="name">id</span>: <span class="name">albumDelegate</span>
      <span class="type"><a href="../qtqmlmodels/qml-qtqml-models-package.html">Package</a></span> {

          <span class="type"><a href="../qtquick/qml-qtquick-item.html">Item</a></span> {
              <span class="name">Package</span>.name: <span class="string">'browser'</span>
              <span class="type"><a href="../qtquick/qml-qtquick-gridview.html">GridView</a></span> {
                  <span class="name">id</span>: <span class="name">photosGridView</span>; <span class="name">model</span>: <span class="name">visualModel</span>.<span class="name">parts</span>.<span class="name">grid</span>; <span class="name">width</span>: <span class="name">mainWindow</span>.<span class="name">width</span>; <span class="name">height</span>: <span class="name">mainWindow</span>.<span class="name">height</span> <span class="operator">-</span> <span class="number">21</span>
                  <span class="name">x</span>: <span class="number">0</span>; <span class="name">y</span>: <span class="number">21</span>; <span class="name">cellWidth</span>: <span class="number">160</span>; <span class="name">cellHeight</span>: <span class="number">153</span>; <span class="name">interactive</span>: <span class="number">false</span>
                  <span class="name">onCurrentIndexChanged</span>: <span class="name">photosListView</span>.<span class="name">positionViewAtIndex</span>(<span class="name">currentIndex</span>, <span class="name">ListView</span>.<span class="name">Contain</span>)
              }
          }

          <span class="type"><a href="../qtquick/qml-qtquick-item.html">Item</a></span> {
              <span class="name">Package</span>.name: <span class="string">'fullscreen'</span>
              <span class="type"><a href="../qtquick/qml-qtquick-listview.html">ListView</a></span> {
                  <span class="name">id</span>: <span class="name">photosListView</span>; <span class="name">model</span>: <span class="name">visualModel</span>.<span class="name">parts</span>.<span class="name">list</span>; <span class="name">orientation</span>: <span class="name">Qt</span>.<span class="name">Horizontal</span>
                  <span class="name">width</span>: <span class="name">mainWindow</span>.<span class="name">width</span>; <span class="name">height</span>: <span class="name">mainWindow</span>.<span class="name">height</span>; <span class="name">interactive</span>: <span class="number">false</span>
                  <span class="name">onCurrentIndexChanged</span>: <span class="name">photosGridView</span>.<span class="name">positionViewAtIndex</span>(<span class="name">currentIndex</span>, <span class="name">GridView</span>.<span class="name">Contain</span>)
                  <span class="name">highlightRangeMode</span>: <span class="name">ListView</span>.<span class="name">StrictlyEnforceRange</span>; <span class="name">snapMode</span>: <span class="name">ListView</span>.<span class="name">SnapOneItem</span>
              }
          }

          <span class="type"><a href="../qtquick/qml-qtquick-item.html">Item</a></span> {
              <span class="name">Package</span>.name: <span class="string">'album'</span>
              <span class="name">id</span>: <span class="name">albumWrapper</span>; <span class="name">width</span>: <span class="number">210</span>; <span class="name">height</span>: <span class="number">220</span>

              <span class="type"><a href="../qtqmlmodels/qml-qtqml-models-delegatemodel.html">DelegateModel</a></span> {
                  <span class="name">id</span>: <span class="name">visualModel</span>; <span class="name">delegate</span>: <span class="name">PhotoDelegate</span> { }
                  <span class="name">model</span>: <span class="name">RssModel</span> { <span class="name">id</span>: <span class="name">rssModel</span>; <span class="name">tags</span>: <span class="name">tag</span> }
              }

              <span class="type"><a href="../qtquickcontrols/qml-qtquick-controls2-busyindicator.html">BusyIndicator</a></span> {
                  <span class="name">id</span>: <span class="name">busyIndicator</span>
                  <span class="type">anchors</span> { <span class="name">centerIn</span>: <span class="name">parent</span>; <span class="name">verticalCenterOffset</span>: -<span class="number">20</span> }
                  <span class="name">on</span>: <span class="name">rssModel</span>.<span class="name">status</span> <span class="operator">!=</span> <span class="name">XmlListModel</span>.<span class="name">Ready</span>
              }

              <span class="type"><a href="../qtquick/qml-qtquick-pathview.html">PathView</a></span> {
                  <span class="name">id</span>: <span class="name">photosPathView</span>; <span class="name">model</span>: <span class="name">visualModel</span>.<span class="name">parts</span>.<span class="name">stack</span>; <span class="name">pathItemCount</span>: <span class="number">5</span>
                  <span class="name">visible</span>: !<span class="name">busyIndicator</span>.<span class="name">visible</span>
                  <span class="name">anchors</span>.centerIn: <span class="name">parent</span>; <span class="name">anchors</span>.verticalCenterOffset: -<span class="number">30</span>
                  <span class="name">path</span>: <span class="name">Path</span> {
                      <span class="type"><a href="../qtquick/qml-qtquick-pathattribute.html">PathAttribute</a></span> { <span class="name">name</span>: <span class="string">'z'</span>; <span class="name">value</span>: <span class="number">9999.0</span> }
                      <span class="type"><a href="../qtquick/qml-qtquick-pathline.html">PathLine</a></span> { <span class="name">x</span>: <span class="number">1</span>; <span class="name">y</span>: <span class="number">1</span> }
                      <span class="type"><a href="../qtquick/qml-qtquick-pathattribute.html">PathAttribute</a></span> { <span class="name">name</span>: <span class="string">'z'</span>; <span class="name">value</span>: <span class="number">0.0</span> }
                  }
              }

              <span class="type"><a href="../qtquick/qml-qtquick-mousearea.html">MouseArea</a></span> {
                  <span class="name">anchors</span>.fill: <span class="name">parent</span>
                  <span class="name">onClicked</span>: <span class="name">mainWindow</span>.<span class="name">editMode</span> ? <span class="name">photosModel</span>.<span class="name">remove</span>(<span class="name">index</span>) : <span class="name">albumWrapper</span>.<span class="name">state</span> <span class="operator">=</span> <span class="string">'inGrid'</span>
              }

              <span class="type">Tag</span> {
                  <span class="type">anchors</span> { <span class="name">horizontalCenter</span>: <span class="name">parent</span>.<span class="name">horizontalCenter</span>; <span class="name">bottom</span>: <span class="name">parent</span>.<span class="name">bottom</span>; <span class="name">bottomMargin</span>: <span class="number">10</span> }
                  <span class="name">frontLabel</span>: <span class="name">tag</span>; <span class="name">backLabel</span>: <span class="name">qsTr</span>(<span class="string">&quot;Remove&quot;</span>); <span class="name">flipped</span>: <span class="name">mainWindow</span>.<span class="name">editMode</span>
                  <span class="name">onTagChanged</span>: <span class="name">rssModel</span>.<span class="name">tags</span> <span class="operator">=</span> <span class="name">tag</span>
                  <span class="name">onBackClicked</span>: <span class="keyword">if</span> (<span class="name">mainWindow</span>.<span class="name">editMode</span>) <span class="name">photosModel</span>.<span class="name">remove</span>(<span class="name">index</span>);
              }

              <span class="name">states</span>: [
              <span class="type"><a href="../qtqml/qml-qtqml-statemachine-state.html">State</a></span> {
                  <span class="name">name</span>: <span class="string">'inGrid'</span>
                  <span class="type"><a href="../qtquick/qml-qtquick-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">photosGridView</span>; <span class="name">interactive</span>: <span class="number">true</span> }
                  <span class="type"><a href="../qtquick/qml-qtquick-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">albumsShade</span>; <span class="name">opacity</span>: <span class="number">1</span> }
                  <span class="type"><a href="../qtquick/qml-qtquick-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">backButton</span>; <span class="name">onClicked</span>: <span class="name">albumWrapper</span>.<span class="name">state</span> <span class="operator">=</span> <span class="string">''</span>; <span class="name">y</span>: <span class="number">6</span> }
              },
              <span class="type"><a href="../qtqml/qml-qtqml-statemachine-state.html">State</a></span> {
                  <span class="name">name</span>: <span class="string">'fullscreen'</span>; <span class="name">extend</span>: <span class="string">'inGrid'</span>
                  <span class="type"><a href="../qtquick/qml-qtquick-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">photosGridView</span>; <span class="name">interactive</span>: <span class="number">false</span> }
                  <span class="type"><a href="../qtquick/qml-qtquick-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">photosListView</span>; <span class="name">interactive</span>: <span class="number">true</span> }
                  <span class="type"><a href="../qtquick/qml-qtquick-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">photosShade</span>; <span class="name">opacity</span>: <span class="number">1</span> }
                  <span class="type"><a href="../qtquick/qml-qtquick-propertychanges.html">PropertyChanges</a></span> { <span class="name">target</span>: <span class="name">backButton</span>; <span class="name">y</span>: -<span class="name">backButton</span>.<span class="name">height</span> <span class="operator">-</span> <span class="number">8</span> }
              }
              ]

              <span class="name">GridView</span>.onAdd: <span class="name">NumberAnimation</span> {
                  <span class="name">target</span>: <span class="name">albumWrapper</span>; <span class="name">properties</span>: <span class="string">&quot;scale&quot;</span>; <span class="name">from</span>: <span class="number">0.0</span>; <span class="name">to</span>: <span class="number">1.0</span>; <span class="name">easing</span>.type: <span class="name">Easing</span>.<span class="name">OutQuad</span>
              }
              <span class="name">GridView</span>.onRemove: <span class="name">SequentialAnimation</span> {
                  <span class="type"><a href="../qtquick/qml-qtquick-propertyaction.html">PropertyAction</a></span> { <span class="name">target</span>: <span class="name">albumWrapper</span>; <span class="name">property</span>: <span class="string">&quot;GridView.delayRemove&quot;</span>; <span class="name">value</span>: <span class="number">true</span> }
                  <span class="type"><a href="../qtquick/qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">target</span>: <span class="name">albumWrapper</span>; <span class="name">property</span>: <span class="string">&quot;scale&quot;</span>; <span class="name">from</span>: <span class="number">1.0</span>; <span class="name">to</span>: <span class="number">0.0</span>; <span class="name">easing</span>.type: <span class="name">Easing</span>.<span class="name">OutQuad</span> }
                  <span class="type"><a href="../qtquick/qml-qtquick-propertyaction.html">PropertyAction</a></span> { <span class="name">target</span>: <span class="name">albumWrapper</span>; <span class="name">property</span>: <span class="string">&quot;GridView.delayRemove&quot;</span>; <span class="name">value</span>: <span class="number">false</span> }
              }

              <span class="name">transitions</span>: [
              <span class="type"><a href="../qtquick/qml-qtquick-transition.html">Transition</a></span> {
                  <span class="name">from</span>: <span class="string">'*'</span>; <span class="name">to</span>: <span class="string">'inGrid'</span>
                  <span class="type"><a href="../qtquick/qml-qtquick-sequentialanimation.html">SequentialAnimation</a></span> {
                      <span class="type"><a href="../qtquick/qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">properties</span>: <span class="string">'opacity'</span>; <span class="name">duration</span>: <span class="number">250</span> }
                      <span class="type"><a href="../qtquick/qml-qtquick-pauseanimation.html">PauseAnimation</a></span> { <span class="name">duration</span>: <span class="number">350</span> }
                      <span class="type"><a href="../qtquick/qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">target</span>: <span class="name">backButton</span>; <span class="name">properties</span>: <span class="string">&quot;y&quot;</span>; <span class="name">duration</span>: <span class="number">200</span>; <span class="name">easing</span>.type: <span class="name">Easing</span>.<span class="name">OutQuad</span> }
                  }
              },
              <span class="type"><a href="../qtquick/qml-qtquick-transition.html">Transition</a></span> {
                  <span class="name">from</span>: <span class="string">'inGrid'</span>; <span class="name">to</span>: <span class="string">'*'</span>
                  <span class="type"><a href="../qtquick/qml-qtquick-numberanimation.html">NumberAnimation</a></span> { <span class="name">properties</span>: <span class="string">&quot;y,opacity&quot;</span>; <span class="name">easing</span>.type: <span class="name">Easing</span>.<span class="name">OutQuad</span>; <span class="name">duration</span>: <span class="number">300</span> }
              }
              ]
          }
      }
  }

</pre>
